define(["app"], function(app) {
	var deps = ["$http", "BaseService"];
	
	function resource($http, BaseService) {
		return initAuthResource($http,BaseService.restfulUrl + "address/");
	}
	
	var postHeader = {
			"Content-Type" : "application/x-www-form-urlencoded;charset=utf-8"
	};
	
	function initAuthResource($http,authUrl){
		return {
			saveFunction:function(functionVo){
				return $http.post(authUrl + "saveFunction", angular.toJson(functionVo));
			},
			getFunctions:function(){
				return $http.get(authUrl + "getFunctions");
			},
			saveRoleFunction:function(roleFunctionVo){
				return $http.post(authUrl + "saveRoleFunction", angular.toJson(roleFunctionVo));
			},
			getRoleFunctionByType:function(data){
				return $http.get(authUrl + "getRoleFunctionByType", {
                    params: {
                        type:data
                    }
				});
			},
			getRoleFunctionById:function(id){
				return $http.get(authUrl + "getRoleFunctionById", {
                    params: {
                    	roleFunctionId:id
                    }
				});
			},
			getFunctionById:function(id){
				return $http.get(authUrl + "getFunctionById", {
                    params: {
                    	functionId:id
                    }
				});
			}
		};
	}
	resource.$inject = deps;
	app.lazy.factory("AuthResource", resource);
});
